<?php

/*
 * report by substatus calculation
 */

// Retrieving SRs and substatuses.
$query = 'select
        tse.team,
        tse.tse_name,
        srsubstatus.val as substatus,
        count(srsubstatus.val) as amount
    from tse, srs, srsubstatus
    where
        tse.owner_id=srs.owner and
        srs.sub_status=srsubstatus.id and
        srs.owner in (' . $ids . ')
        and srs.closed >=' . $from . ' and
        srs.closed <=' . $till . '
    group by tse.team
    order by tse.team, tse.tse_name, substatus';
@ $result = mysql_query($query);
//echo $query.'<br>';
while (@ $res = mysql_fetch_assoc($result)) {
    $big[$res['team']][$res['tse_name']][$res['substatus']] = $res['amount'];
}
@ mysql_free_result($result);

echo 'Report by SR Substatus: <pre>';print_r($big);echo'</pre>';


?>


